/**
 * Created with  SublimeText
 * @Author:      Lyle
 * @DateTime:    2017-03-13 10:59:00
 * @Description: 
 */
import axios from 'axios'
import qs from 'qs'
import permissionPartMixin from '../common/permissionPartMixin'

//API global control
axios.defaults.baseURL = Config.API_URL;
axios.defaults.timeout = 60000;
axios.defaults.withCredentials = true; //firefox
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
axios.defaults.transformRequest = [function(data) {
    //console.log(qs.stringify(data)); 
    //return a string or an instance of Buffer, ArrayBuffer,FormData or Stream
    return qs.stringify(data);
}];

// Add a request interceptor
axios.interceptors.request.use(function(config) {
    let sid = Unit.getSessionStorage('sid');
    if (sid) {
        let url = config.url.replace(config.baseURL, config.baseURL + 's' + sid + '/');
        config.url = url;
    }
    return config;
}, function(error) {
    return Promise.reject(error);
});

// Add a response interceptor
axios.interceptors.response.use(function(response) {
    console.log('response', response);
    if (response.data.errcode == 100) {
        permissionPartMixin.methods.permissionPartMixin_BrowserClear();
        return Promise.reject(response.data);
    } else {
        return response;
    }
}, function(error) {
    return Promise.reject(error);
});

//axios 
function requestEntrance(data, callback) {
    if (typeof(callback) === 'object') {
        callback.success = callback.success || function() {};
        callback.error = callback.error || function() {};
        callback.complete = callback.complete || function() {};
        axios(data)
            .then(function(response) {
                if (response) {
                    callback.complete();
                    callback.success(response.data);
                }
            })
            .catch(function(error) {
                callback.complete();
                callback.error(error);
                alert('Oops! There was a problem connecting to the network. Please refresh!(' + data.url + ')');
                console.log('error:', data.url, error);
            });
    }
}

/****************************** api **************************/
//API get_profile_options
export function get_profile_options(obj) {
    let requestData = {
            method: 'post',
            url: 'get_profile_options',
            data: obj.data
        },
        requestCallback = {};

    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };

    requestEntrance(requestData, requestCallback);
}

//API login
export function login(obj) {
    let requestData = {
            method: 'post',
            url: 'login',
            data: obj.data
        },
        requestCallback = {};

    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };

    /*
    requestCallback.error = function(error) {
        obj.error ? obj.error(error) : '';
    };*/
    requestCallback.complete = function() {
        obj.complete ? obj.complete() : '';
    };

    requestEntrance(requestData, requestCallback);
}

//API get_last_search
export function get_last_search(obj) {
    let requestData = {
            method: 'post',
            url: 'get_last_search',
            data: obj.data
        },
        requestCallback = {};

    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };

    requestEntrance(requestData, requestCallback);
}

//API match_filter
export function match_filter(obj) {
    let requestData = {
            method: 'post',
            url: 'match_filter',
            data: obj.data
        },
        requestCallback = {};

    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };

    requestEntrance(requestData, requestCallback);
}

//API loginout
export function login_out(obj) {
    let requestData = {
            method: 'post',
            url: 'logout',
        },
        requestCallback = {};

    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.complete = function() {
        obj.complete ? obj.complete() : '';
    };

    requestEntrance(requestData, requestCallback);
}

//API visitorsList
export function visitors_list(obj) {
    let requestData = {
            method: 'post',
            url: 'my_visitors',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API winkedList
export function winked_list(obj) {
    let requestData = {
            method: 'post',
            url: 'winkedme',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API favedMeList
export function favedMe_list(obj) {
    let requestData = {
            method: 'post',
            url: 'interested_in_me',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API myFavesList
export function myFaves_list(obj) {
    let requestData = {
            method: 'post',
            url: 'my_favors',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API forget_password
export function forget_password(obj) {
    let requestData = {
            method: 'post',
            url: 'forget_password',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('forget_password', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API get_country_list
export function get_country_list(obj) {
    let requestData = {
            method: 'get',
            url: 'get_country_list'
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response.data) : '';
    };
    requestCallback.error = function(error) {
        console.log('get_country_list', error);
    };
    requestCallback.complete = function(response) {
        // callback(response.data);
    };
    requestEntrance(requestData, requestCallback);
}

//API get_state_list
export function get_state_list(obj) {
    let requestData = {
            method: 'get',
            url: 'get_state_list?country=' + obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response.data) : '';
    };
    requestCallback.error = function(error) {
        console.log('get_state_list', error);
    };
    requestCallback.complete = function(response) {
        //callback(response.data);
    };
    requestEntrance(requestData, requestCallback);
}

//API check_zip
export function check_zip(obj) {
    let requestData = {
            method: 'post',
            url: 'check_zip',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('check_zip', error);
    };
    requestCallback.complete = function(response) {
        // callback(response.data);
    };
    requestEntrance(requestData, requestCallback);
}

//API check_username
export function check_username(obj) {
    let requestData = {
            method: 'post',
            url: 'check_username',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('check_username', error);
    };
    requestCallback.complete = function(response) {
        // callback(response.data);
    };
    requestEntrance(requestData, requestCallback);
}

//API check_email
export function check_email(obj) {
    let requestData = {
            method: 'post',
            url: 'check_email',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('check_email', error);
    };
    requestCallback.complete = function(response) {
        // callback(response.data);
    };
    requestEntrance(requestData, requestCallback);
}

//API register
export function register(obj) {
    let requestData = {
            method: 'post',
            url: 'register',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('register', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API feedback
export function feedback(obj) {
    let requestData = {
            method: 'post',
            url: 'feedback',
            data: obj.data,
            transformRequest: [function(data) {
                return data;
            }]
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('register', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API user_profile
export function user_profile(obj) {
    let requestData = {
            method: 'post',
            url: 'user_profile',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('user_profile', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API send_wink
export function send_wink(obj) {
    let requestData = {
            method: 'post',
            url: 'send_wink',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('send_wink', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API add_favor
export function add_favor(obj) {
    let requestData = {
            method: 'post',
            url: 'add_favor',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('add_favor', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API remove_favor
export function remove_favor(obj) {
    let requestData = {
            method: 'post',
            url: 'remove_favor',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('remove_favor', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API change_email
export function change_email(obj) {
    let requestData = {
            method: 'post',
            url: 'change_email',
            data: obj.data,
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('change_email', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API reset_password
export function reset_password(obj) {
    let requestData = {
            method: 'post',
            url: 'reset_password',
            data: obj.data,
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('reset_password', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}


//API who_blocked
export function who_blocked(obj) {
    let requestData = {
            method: 'post',
            url: 'who_blocked',
            data: obj.data,
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('who_blocked', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API service_agreement
export function service_agreement(obj) {
    let requestData = {
            method: 'post',
            url: 'service_agreement',
            data: obj.data,
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        // console.log('service_agreement', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API privacy_policy
export function privacy_policy(obj) {
    let requestData = {
            method: 'post',
            url: 'privacy_policy',
            data: obj.data,
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        // console.log('privacy_policy', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API request_photo
export function request_photo(obj) {
    let requestData = {
            method: 'post',
            url: 'request_photo',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('request_photo', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API set_photo_order
export function set_photo_order(obj) {
    let requestData = {
            method: 'post',
            url: 'set_photo_order',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('set_photo_order', error);
    };
    requestCallback.complete = function(response) {
        // callback(response.data);
    };
    requestEntrance(requestData, requestCallback);

}

//API move_photo
export function move_photo(obj) {
    let requestData = {
            method: 'post',
            url: 'move_photo',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('move_photo', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete() : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API delete_photo
export function delete_photo(obj) {
    let requestData = {
            method: 'post',
            url: 'delete_photo',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('delete_photo', error);
    };
    requestCallback.complete = function(response) {
        //callback(response.data);
    };
    requestEntrance(requestData, requestCallback);
}

//API report
export function report(obj) {
    let requestData = {
            method: 'post',
            url: 'report',
            data: obj.data
        },
        requestCallback = {};
    if (typeof(obj.format) != 'undefined' && obj.format) {
        requestData.transformRequest = [function(data) {
            return data;
        }];
    }
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('report', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API hidden_from_search
export function hidden_from_search(obj) {
    let requestData = {
            method: 'post',
            url: 'hidden_from_search',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('hidden_from_search', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API block
export function block(obj) {
    let requestData = {
            method: 'post',
            url: 'block',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('block', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API privacy_setting
export function privacy_setting(obj) {
    let requestData = {
            method: 'post',
            url: 'privacy_setting',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('privacy_setting', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API common_upload_img
export function common_upload_img(obj) {
    let requestData = {
            method: 'post',
            url: 'common_upload_img',
            data: obj.data,
            transformRequest: [function(data) {
                return data;
            }],
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('common_upload_img', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API set_hidden
export function set_hidden(obj) {
    let requestData = {
            method: 'post',
            url: 'set_hidden',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        obj.error ? obj.error(response) : '';
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API private_album_requests
export function private_album_requests(obj) {
    let requestData = {
            method: 'post',
            url: 'private_album_requests',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('private_album_requests', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API private_album_requests
export function approve_private_album_request(obj) {
    let requestData = {
            method: 'post',
            url: 'approve_private_album_request',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('approve_private_album_request', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API update_profile
export function update_profile(obj) {
    let requestData = {
            method: 'post',
            url: 'update_profile',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('update_profile', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API who_request_photo
export function who_request_photo(obj) {
    let requestData = {
            method: 'post',
            url: 'who_request_photo',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('who_request_photo', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}


//API who_access_private_photo
export function who_access_private_photo(obj) {
    let requestData = {
            method: 'post',
            url: 'who_access_private_photo',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('who_access_private_photo', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API reactivate
export function reactivate(obj) {
    let requestData = {
            method: 'post',
            url: 'reactivate',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('reactivate', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API request_private_album
export function request_private_album(obj) {
    let requestData = {
            method: 'post',
            url: 'request_private_album',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('request_private_album', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API agree_pp_sa
export function agree_pp_sa(obj) {
    let requestData = {
            method: 'post',
            url: 'agree_pp_sa',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('agree_pp_sa', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API get_sig
export function get_sig(obj) {
    let requestData = {
            method: 'post',
            url: 'get_sig',
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('get_sig', error);
        obj.error ? obj.error(response) : '';
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API disable_account
export function disable_account(obj) {
    let requestData = {
            method: 'post',
            url: 'disable_account',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('disable_account', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API check_password
export function check_password(obj) {
    let requestData = {
            method: 'post',
            url: 'check_password',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('check_password', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API users_profile
export function users_profile(obj) {
    let requestData = {
            method: 'post',
            url: 'users_profile',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('users_profile', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API make_mpaycc_link
export function make_mpaycc_link(obj) {
    let requestData = {
            method: 'post',
            url: 'make_mpaycc_link',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('make_mpaycc_link', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API verify
export function verify(obj) {
    let requestData = {
            method: 'post',
            url: 'verify',
            data: obj.data,
            transformRequest: [function(data) {
                return data;
            }],
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('verify', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API get_file_md5_exists
export function get_file_md5_exists(obj) {
    let requestData = {
            method: 'post',
            url: 'get_file_md5_exists',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('get_file_md5_exists', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API upload_with_p
export function upload_with_p(obj) {
    let requestData = {
            method: 'post',
            url: 'upload_with_p',
            data: obj.data,
            transformRequest: [function(data) {
                return data;
            }],
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('upload_with_p', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API report_message_photo
export function report_message_photo(obj) {
    let requestData = {
            method: 'post',
            url: 'report_message_photo',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('report_message_photo', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API show_mail
export function show_mail(obj) {
    let requestData = {
            method: 'post',
            url: 'show_mail',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('show_mail', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API meet_recommend
export function meet_recommend(obj) {
    let requestData = {
            method: 'post',
            url: 'meet_recommend',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('meet_recommend', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API meet
export function meet(obj) {
    let requestData = {
            method: 'post',
            url: 'meet',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('meet', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API meet_last_round
export function meet_last_round(obj) {
    let requestData = {
            method: 'post',
            url: 'meet_last_round',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('meet_last_round', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API meet_likes_me
export function meet_likes_me(obj) {
    let requestData = {
            method: 'post',
            url: 'meet_likes_me',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('meet_likes_me', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//API meet_my_matched
export function meet_my_matched(obj) {
    let requestData = {
            method: 'post',
            url: 'meet_my_matched',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('meet_my_matched', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}

//status_bar_data
export function status_bar_data(obj) {
    let requestData = {
            method: 'post',
            url: 'status_bar_data',
            data: obj.data
        },
        requestCallback = {};
    requestCallback.success = function(response) {
        obj.success ? obj.success(response) : '';
    };
    requestCallback.error = function(error) {
        console.log('status_bar_data', error);
    };
    requestCallback.complete = function(response) {
        obj.complete ? obj.complete(response) : '';
    };
    requestEntrance(requestData, requestCallback);
}
